package com.wn.consumer.dead;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import sun.awt.SunHints;

/**
 * @author yellow Docter
 * @date 2022 -09-01
 * @desc
 */
@Component
@Slf4j
public class DeadConsumer {

    //创建死信交换机
    //创建死信对象
    @RabbitListener(
        bindings = @QueueBinding(
        value = @Queue(name="dead-queue"),
                exchange = @Exchange(
                        name = "exchange-dead",
                        type = ExchangeTypes.DIRECT
                ),
                key = "dead.to.queue"
        )
    )
    public void deadConsumer(String msg){
        log.info("我是死信消费者,我消息了消息:{}",msg);
    }

}
